#ifndef SIMULATIONWINDOW_H
#define SIMULATIONWINDOW_H

#include <QtOpenGL/QGLWidget>
#include <Render.h>
#include <Box2D/Common/b2Math.h>
namespace sk
{
    class GameProject;
    class GameLevel;
}

class b2World;
class b2Body;
class QTimer;
class QMouseEvent;


class SimulationWindow : public QGLWidget
{
    Q_OBJECT
public:
    explicit SimulationWindow(QWidget *parent = 0);
    ~SimulationWindow();
    void start(int lvl, bool isGame);
    void stop();
public slots:
    void onTimer();
protected:
    void initializeGL();
    void resizeGL(int w, int h);
    void paintGL();
    void mousePressEvent(QMouseEvent * event);
    void mouseReleaseEvent(QMouseEvent * event);
    void mouseMoveEvent(QMouseEvent * event);

private:
    void initWorld(int level);
private:
    bool _isGame;
    DebugDraw _dd;
    sk::GameProject * _simProject;
    b2World * _world;
    b2Body  * _next;
    QTimer * _timer;
    int _objInd;
    sk::GameLevel * _level;
    float _needTime;
    b2Vec2 _mPos;
    bool _canPaste;
};

#endif // SIMULATIONWINDOW_H
